Index: cache.fs.inc
===================================================================
--- cache.fs.inc	(revision 13)
+++ cache.fs.inc	(working copy)
@@ -8,6 +8,16 @@
 
 define('FASTPATH_FSCACHE_PATH', '/tmp');
 
+function cache_delete_file($file) {
+	if ($_SERVER['WINDIR'] || $_SERVER['windir']) {
+		$file=realpath($file);
+		return system("del $file");
+	} else {
+		return unlink($file);
+	}
+	exit;
+}
+
 /**
  * Return data from the persistent cache.
  *
@@ -59,8 +69,9 @@
   $cache_file = cache_filename($key, $table);
 
   if (file_exists($cache_file)) {    
+    $file_size=filesize($cache_file);
     if ($fp = fopen($cache_file, 'r')) {
-      if (flock($fp, LOCK_SH)) {
+      if (flock($fp, LOCK_SH) and $file_size>0) {
         $data = fread($fp, filesize($cache_file));
         flock($fp, LOCK_UN);
         $cache = unserialize($data);
@@ -216,7 +227,7 @@
       // only delete the cache file once we obtain an exclusive lock to prevent
       // deleting a cache file that is currently being read.
       if (flock($fp, LOCK_EX)) { //commented by sina
-        unlink($file);
+        cache_delete_file($file);
       }
     }
   }
Index: fastpath_fscache.module
===================================================================
--- fastpath_fscache.module	(revision 13)
+++ fastpath_fscache.module	(working copy)
@@ -55,7 +55,7 @@
         // We need an exclusive lock, but don't block if we can't get it as
         // we can simply try again next time cron is run.
         if (flock($fp, LOCK_EX|LOCK_NB)) {
-          unlink($file->filename);
+          cache_delete_file($file->filename);
         }
       }
     }
@@ -79,7 +79,7 @@
              $mtime < (time() - $cache_lifetime)) {
           if ($fp = fopen($cache_file, 'r')) {
             if (flock($fp, LOCK_EX)) {
-              unlink($cache_file);
+              cache_delete_file($cache_file);
             }
           }
         }
